#include <gtkmm.h>

class MyWindow : public Gtk::Window {
public:
    MyWindow() {
        set_title("GtkLabel Example");
        set_default_size(300, 200);

        // 创建一个垂直盒子容器
        Gtk::Box* vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 10));
        add(*vbox);

        // 创建简单文本标签
        Gtk::Label* label1 = Gtk::manage(new Gtk::Label("This is a simple label."));
        vbox->pack_start(*label1);

        // 创建带有格式化文本的标签
        Gtk::Label* label2 = Gtk::manage(new Gtk::Label());
        label2->set_markup("<b>This is bold text</b> and <i>this is italic text</i>.");
        vbox->pack_start(*label2);

        // 创建一个带有自动换行功能的标签
        Gtk::Label* label3 = Gtk::manage(new Gtk::Label("This is a long text that will wrap automatically when it reaches the end of the window width."));
        label3->set_line_wrap(true);
        vbox->pack_start(*label3);

        // 创建一个带有选择功能的标签
        Gtk::Label* label4 = Gtk::manage(new Gtk::Label("This text is selectable. You can copy it."));
        label4->set_selectable(true);
        vbox->pack_start(*label4);

        // 显示所有子控件
        show_all_children();
    }

    virtual ~MyWindow() {}
};

int main(int argc, char *argv[]) {
    auto app = Gtk::Application::create(argc, argv, "com.example.GtkLabelExample");

    MyWindow window;

    return app->run(window);
}
